//////////////////////////////////////////////////////////////////////////////
//                                                                          //
// Copyright (C) LibG.org. 2008. All rights reserved.                       //
//                                                                          //
// Licensed under GPL, you may use this file except for commercial purpose. //
//                                                                          //
// Permission to use, copy, modify, and distribute this software in object  //
// code form for any purpose and without fee is hereby granted, provided    //
// that the above copyright notice appears in all copies and that both that //
// copyright notice and the limited warranty and restricted rights notice   //
// below appear in all supporting documentation.                            //
//                                                                          //
//////////////////////////////////////////////////////////////////////////////

#include "givector3.h"
#include "gipoint3.h"

const giPoint3 giPoint3::kZero( 0.0, 0.0, 0.0 );

giPoint3::giPoint3()
: giValueFloat3( 0.0, 0.0, 0.0 )
{
}

giPoint3::giPoint3( const giPoint3& v )
: giValueFloat3( v.x, v.y, v.z )
{
}

giPoint3::giPoint3( const giDouble& vx, const giDouble& vy, const giDouble& vz )
: giValueFloat3( vx, vy, vz )
{
}

giPoint3& giPoint3::operator += ( const giPoint3& v )
{
    x += v.x;   y += v.y;   z += v.z;
    return *this;
}

giPoint3& giPoint3::operator -= ( const giPoint3& v )
{
    x -= v.x;   y -= v.y;   z -= v.z;
    return *this;
}

giPoint3& giPoint3::operator *= ( const giDouble& v )
{
    x *= v;     y *= v;     z *= v;
    return *this;
}

giPoint3& giPoint3::operator /= ( const giDouble& v )
{
    x /= v;     y /= v;     z /= v;
    return *this;
}

giPoint3 giPoint3::operator + () const
{
    return *this;
}

giPoint3 giPoint3::operator - () const
{
    return giPoint3( -x, -y, -z );
}

giPoint3 giPoint3::operator + ( const giPoint3& v ) const
{
    return giPoint3( x + v.x, y + v.y, z + v.z );
}

giPoint3 giPoint3::operator - ( const giPoint3& v ) const
{
    return giPoint3( x - v.x, y - v.y, z - v.z );
}

giPoint3 giPoint3::operator * ( const giDouble& v ) const
{
    return giPoint3( x * v, y * v, z * v );
}

giPoint3 giPoint3::operator / ( const giDouble& v ) const
{
    return giPoint3( x / v, y / v, z / v );
}

bool giPoint3::operator == ( const giPoint3& v ) const
{
    return x == v.x && y == v.y && z == v.z;
}

bool giPoint3::operator != ( const giPoint3& v ) const
{
    return x != v.x || y != v.y || z != v.z;
}

giVector3 giPoint3::toVector() const
{
    return giVector3( x, y, z );
}